package com.zy.rest.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zy.common.util.TaotaoResult;
import com.zy.rest.service.RedisService;

/**
 *  实现同步清除缓存，在后端添加，修改，更新数据时，触发RPC远程调用
 *  http://127.0.0.1:8081/cache/sync/content/{categoryId}
 * @author fys
 *
 */
@Controller
@RequestMapping("/cache/sync")
public class RedisController {

	@Autowired
	private RedisService redisService;
	
	@RequestMapping("/content/{categoryId}")
	@ResponseBody
	public TaotaoResult contentCacheSync(@PathVariable long categoryId) {
		TaotaoResult result=redisService.syncContent(categoryId);
		return result;
	}
}
